Client Report - Exploring Names

Unit 1 Task 1

Author

Daniel Watts

Show the code
import pandas as pd
import numpy as np
from lets_plot import *

LetsPlot.setup_html(isolated_frame=True)
Show the code
# Learn morea about Code Cells: https://quarto.org/docs/reference/cells/cells-jupyter.html

# Include and execute your code here
df = pd.read_csv("https://github.com/byuidatascience/data4names/raw/master/data-raw/names_year/names_year.csv")

QUESTION 1

What was the earliest year that the name ‘Felisha’ was used?

Felisha was first used in 1964.

Show the code
# Q1
df.head
df.query("name == ['Felisha']").sort_values('year', ascending = True)
name year AK AL AR AZ CA CO CT DC ... TN TX UT VA VT WA WI WV WY Total
135125 Felisha 1964 0.0 6.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 9.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 20.0
135126 Felisha 1965 0.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 ... 0.0 5.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 10.0
135127 Felisha 1966 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 25.0
135128 Felisha 1967 0.0 7.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 6.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 24.0
135129 Felisha 1968 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 6.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 18.0
135130 Felisha 1969 0.0 0.0 0.0 0.0 7.0 0.0 0.0 0.0 ... 0.0 8.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 32.0
135131 Felisha 1970 0.0 0.0 0.0 0.0 6.0 0.0 0.0 0.0 ... 0.0 10.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 55.0
135132 Felisha 1971 0.0 0.0 0.0 0.0 7.0 0.0 0.0 0.0 ... 0.0 9.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 48.0
135133 Felisha 1972 0.0 0.0 0.0 0.0 7.0 0.0 0.0 0.0 ... 0.0 18.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 81.0
135134 Felisha 1973 0.0 6.0 8.0 0.0 5.0 0.0 0.0 0.0 ... 0.0 10.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 76.0
135135 Felisha 1974 0.0 8.0 6.0 0.0 8.0 0.0 0.0 0.0 ... 0.0 19.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 90.0
135136 Felisha 1975 0.0 0.0 7.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 14.0 0.0 7.0 0.0 0.0 0.0 0.0 0.0 103.0
135137 Felisha 1976 0.0 6.0 8.0 0.0 7.0 0.0 0.0 0.0 ... 7.0 8.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 113.0
135138 Felisha 1977 0.0 10.0 0.0 0.0 5.0 0.0 0.0 0.0 ... 8.0 19.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 140.0
135139 Felisha 1978 0.0 6.0 6.0 0.0 6.0 0.0 0.0 0.0 ... 9.0 14.0 0.0 5.0 0.0 0.0 0.0 0.0 0.0 105.0
135140 Felisha 1979 0.0 7.0 7.0 0.0 7.0 0.0 0.0 0.0 ... 6.0 15.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 127.0
135141 Felisha 1980 0.0 7.0 6.0 0.0 9.0 0.0 0.0 0.0 ... 5.0 11.0 0.0 6.0 0.0 0.0 0.0 0.0 0.0 95.0
135142 Felisha 1981 0.0 0.0 0.0 5.0 16.0 0.0 0.0 0.0 ... 5.0 8.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 90.0
135143 Felisha 1982 0.0 7.0 7.0 0.0 11.0 5.0 0.0 0.0 ... 0.0 17.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 111.0
135144 Felisha 1983 0.0 0.0 0.0 5.0 13.0 0.0 0.0 0.0 ... 0.0 9.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 63.0
135145 Felisha 1984 0.0 0.0 0.0 0.0 13.0 0.0 0.0 0.0 ... 0.0 21.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 93.0
135146 Felisha 1985 0.0 9.0 5.0 0.0 16.0 8.0 0.0 0.0 ... 8.0 24.0 0.0 0.0 0.0 6.0 0.0 0.0 0.0 193.0
135147 Felisha 1986 0.0 0.0 6.0 0.0 32.0 6.0 0.0 0.0 ... 7.0 33.0 0.0 0.0 0.0 6.0 0.0 7.0 0.0 204.0
135148 Felisha 1987 0.0 9.0 0.0 0.0 34.0 6.0 0.0 0.0 ... 10.0 28.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 215.0
135149 Felisha 1988 0.0 6.0 6.0 10.0 29.0 5.0 0.0 0.0 ... 10.0 27.0 5.0 6.0 0.0 5.0 0.0 5.0 0.0 244.0
135150 Felisha 1989 0.0 5.0 8.0 5.0 41.0 0.0 0.0 0.0 ... 0.0 30.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 240.0
135151 Felisha 1990 0.0 7.0 8.0 0.0 38.0 5.0 0.0 0.0 ... 9.0 25.0 6.0 6.0 0.0 6.0 0.0 0.0 0.0 223.0
135152 Felisha 1991 0.0 0.0 0.0 7.0 33.0 0.0 0.0 0.0 ... 10.0 28.0 7.0 6.0 0.0 0.0 6.0 0.0 0.0 214.0
135153 Felisha 1992 0.0 0.0 0.0 5.0 26.0 0.0 0.0 0.0 ... 13.0 26.0 7.0 0.0 0.0 0.0 0.0 0.0 0.0 181.0
135154 Felisha 1993 0.0 8.0 0.0 0.0 18.0 6.0 0.0 0.0 ... 6.0 23.0 0.0 0.0 0.0 11.0 0.0 0.0 0.0 164.0
135155 Felisha 1994 0.0 5.0 0.0 5.0 21.0 0.0 0.0 0.0 ... 0.0 17.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 119.0
135156 Felisha 1995 0.0 6.0 0.0 0.0 13.0 0.0 0.0 0.0 ... 5.0 24.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 91.0
135157 Felisha 1996 0.0 0.0 6.0 0.0 14.0 0.0 0.0 0.0 ... 0.0 20.0 0.0 5.0 0.0 0.0 0.0 0.0 0.0 76.0
135158 Felisha 1997 0.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 ... 0.0 15.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 38.0
135159 Felisha 1998 0.0 0.0 0.0 0.0 7.0 0.0 0.0 0.0 ... 0.0 14.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 21.0
135160 Felisha 1999 0.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 ... 0.0 6.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 22.0
135161 Felisha 2000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 8.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 15.0
135162 Felisha 2001 0.0 0.0 0.0 0.0 6.0 0.0 0.0 0.0 ... 0.0 7.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 24.0
135163 Felisha 2002 0.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 15.0
135164 Felisha 2003 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5.0
135165 Felisha 2004 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 8.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 8.0
135166 Felisha 2005 0.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5.0
135167 Felisha 2007 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 6.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6.0

43 rows × 54 columns

QUESTION 2

What year had the most babies named ‘David’? How many babies were named ‘David’ that year?

In 1965 there were 64,755 babies named David.

Show the code
# Q2
data=df.query("name == ['David']")
ggplot(data=data, mapping=aes(x='year',y='Total')) + geom_bar(stat='identity')

QUESTION 3

What year did your name hit its peak? How many babies were named your name in that year?

In 1990 there were 26,554 babies with the name Daniel

Show the code
# Q3
data=df.query("name == ['Daniel']")
ggplot(data=data, mapping=aes(x='year',y='Total')) + geom_bar(stat='identity')

QUESTION 4

How many babies are named ‘Oliver’ in the state of Utah for all years?

There were 1704 people named Oliver in Utah.

Show the code
# Q4
nameset = df.query("name == 'Oliver'")
nameset['UT'].sum()
np.float64(1704.0)

QUESTION 5

In the most recent year, what was the most common female name in Utah? Emma was the most common Female name in 2015. The most common name overall was William.

Show the code
# Q5

nameset = df.query('year=='+str(df['year'].max()))[['name','year','UT']].sort_values('UT',ascending=False)
nameset.head()
name year UT
384626 William 2015 309.0
123466 Emma 2015 281.0
295971 Oliver 2015 280.0
296077 Olivia 2015 277.0
176706 James 2015 230.0